<?php

declare(strict_types=1);

namespace App\CustHub\Model;

use Mine\MineModel;

/**
 * @property int $id 
 * @property int $scheme_id 方案ID
 * @property int $robot_id 机器人ID
 * @property int $cust_mon_scope 客户监听范围：0=全部 1=指定 2=不监听
 * @property array $cust_exclude_config 全部的情况下排除用户配置
 * @property array $cust_scope_config 客户指定范围配置
 * @property int $room_mon_scope 群监听范围：0=全部 1=指定 2=不监听
 * @property array $room_exclude_config 全部的情况下排除群配置
 * @property array $room_scope_config 群指定范围配置
 * @property \Carbon\Carbon $created_at 
 * @property \Carbon\Carbon $updated_at 
 * @property-read null|ChRobot $robot 
 * @property-read null|ChCtrlRoomScheme $scheme 
 */
class ChCtrlRoomSchemeCfg extends MineModel
{
    /**
     * The table associated with the model.
     */
    protected ?string $table = 'ch_ctrl_room_scheme_cfg';

    /**
     * The attributes that are mass assignable.
     */
    protected array $fillable = ['id', 'scheme_id', 'robot_id', 'cust_mon_scope', 'cust_exclude_config', 'cust_scope_config', 'room_mon_scope', 'room_exclude_config', 'room_scope_config', 'created_at', 'updated_at'];

    /**
     * The attributes that should be cast to native types.
     */
    protected array $casts = ['id' => 'integer', 'scheme_id' => 'integer', 'robot_id' => 'integer', 'cust_mon_scope' => 'integer', 'cust_exclude_config' => 'array', 'cust_scope_config' => 'array', 'room_mon_scope' => 'integer', 'room_exclude_config' => 'array', 'room_scope_config' => 'array', 'created_at' => 'datetime', 'updated_at' => 'datetime'];

    public function robot(): \Hyperf\Database\Model\Relations\HasOne
    {
        return $this->hasOne(ChRobot::class, 'id', 'robot_id');
    }

    public function scheme()
    {
        return $this->hasOne(ChCtrlRoomScheme::class, 'id', 'scheme_id');
    }
}
